package cn.tedu.seckill.consumer

import java.util.Date

import org.springframework.amqp.rabbit.annotation.RabbitListener
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Component

import cn.tedu.seckill.mapper.SecMapper
import cn.tedu.seckill.mapper.SucMapper
import cn.tedu.staticResources.ComRe

@Component
class SendConsumer2 {
	@Autowired
	private var secMapper:SecMapper=_ 
	@Autowired
	private var sucMapper:SucMapper=_ 

	@RabbitListener(queues = {Array(ComRe.seckillQ01)})
	def seckillSuccess(msg:String) {
		val userPhone =msg.split("/")(0).toLong
		val seckillId = msg.split("/")(1).toLong
		val nowTime = new Date()
		val result = secMapper.updateNum(seckillId, nowTime)
		if (true) println("失败")
	}
}